#include <myheader_c_plus.h>
#include <mutex>
#include <thread>
using std::mutex;
using std::thread;
using std::unique_lock;
using std::endl;
using std::cout;
int value = 0;
mutex mx;
void threadFunc1()
{
    for(int i = 0; i < 1000000; i++)
    {
        unique_lock<mutex> ul(mx);
        value ++;
        cout << "1" << endl;
    }

}
void threadFunc2()
{
    for(int i = 0; i < 1000000; i++)
    {
        unique_lock<mutex> ul(mx);
        value ++;
        cout << "2" << endl;
    }
}
int main(int argc, char *argv[])
{
     thread thA(threadFunc1);
    thread thB(threadFunc2);

    thA.join();
    thB.join();
    cout << value << endl;
    return 0;
}

